package hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;

public final class hibernateUtil {
	
	private static final SessionFactory SESSION_FACTORY;
	
	static {
		Configuration configuration = new Configuration().configure();
		StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
		SESSION_FACTORY = configuration.buildSessionFactory(serviceRegistry);
	}

	private hibernateUtil() {}

	public static SessionFactory getSessionFactory() {
		return SESSION_FACTORY;
	}
	
}
